package com.gupao.edu.study.thread.aqs;

import java.util.HashMap;

public class ConcurrentHashMapTest {
    private  static final long count = 100001;

    public static void main(String[] args) throws InterruptedException {
//        System.out.println((1 << 30)>>> 1);//1073741824   536870912
        HashMap hashMap = new HashMap(100000);
    }

    /**
     * ConcurrentHashMap有参Map 构造解析
     * sizeCtl = 16默认hashmap长度
     * putAll(m)
     * tryPresize
     * @param c
     * @return
     */
    private static final int MAXIMUM_CAPACITY = 1 << 30;
    private static final int tableSizeFor(int c) {
        int n = c - 1;
        n |= n >>> 1;
        n |= n >>> 2;
        n |= n >>> 4;
        n |= n >>> 8;
        n |= n >>> 16;
        return (n < 0) ? 1 : (n >= MAXIMUM_CAPACITY) ? MAXIMUM_CAPACITY : n + 1;
    }
}
